package com.fasteat.menu.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasteat.menu.annotation.Unchangeable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author run
 * @since 2021-01-19
 */
@ApiModel(value="菜谱对象", description="菜谱信息表")
@TableName(value = "t_menu_info")
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜谱id")
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty(value = "菜谱标题")
    @NotEmpty(message = "菜谱标题不能为空")
    private String menuTitle;

    @ApiModelProperty(value = "菜谱内容")
    @NotEmpty(message = "菜谱内容不能为空")
    private String menuContext;

    @ApiModelProperty(value = "菜谱封面")
    @NotEmpty(message = "菜谱封面不能为空")
    private String menuCover;

    @ApiModelProperty(value = "菜谱标签")
    private String menuTag;

    @ApiModelProperty(value = "菜谱作者id")
    @NotEmpty(message = "作者id不能为空")
    @Unchangeable
    private String authorId;

    @ApiModelProperty(value = "菜谱作者昵称",hidden = true)
    @TableField(exist = false)
    private String authorName;

    @ApiModelProperty(value = "菜谱作者头像",hidden = true)
    @TableField(exist = false)
    private String authorAvatar;

    @ApiModelProperty(value = "菜谱用料表")
    @Valid
    @TableField(exist = false)
    private List<Material> materials;

    @ApiModelProperty(value = "菜谱浏览量")
    @TableField(fill = FieldFill.INSERT)
    private Integer menuView;

    @ApiModelProperty(value = "菜谱点赞数")
    @TableField(fill = FieldFill.INSERT)
    private Integer menuPraise;

    @ApiModelProperty(value = "菜谱评论数")
    @TableField(fill = FieldFill.INSERT)
    private Integer menuComment;

    @ApiModelProperty(value = "菜谱收藏数")
    @TableField(fill = FieldFill.INSERT)
    private Integer menuCollect;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @Unchangeable
    private Date gmtCreate;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    @ApiModelProperty(value = "逻辑删除,是1、否0")
    @Unchangeable
    @TableLogic
    private Integer isDeleted;

    @ApiModelProperty(value = "乐观锁")
    @Version
    private Integer version;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMenuTitle() {
        return menuTitle;
    }

    public void setMenuTitle(String menuTitle) {
        this.menuTitle = menuTitle;
    }

    public String getMenuContext() {
        return menuContext;
    }

    public void setMenuContext(String menuContext) {
        this.menuContext = menuContext;
    }

    public String getMenuCover() {
        return menuCover;
    }

    public void setMenuCover(String menuCover) {
        this.menuCover = menuCover;
    }

    public String getMenuTag() {
        return menuTag;
    }

    public void setMenuTag(String menuTag) {
        this.menuTag = menuTag;
    }

    public String getAuthorId() {
        return authorId;
    }

    public void setAuthorId(String authorId) {
        this.authorId = authorId;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public List<Material> getMaterials() {
        return materials;
    }

    public void setMaterials(List<Material> materials) {
        this.materials = materials;
    }

    public Integer getMenuView() {
        return menuView;
    }

    public void setMenuView(Integer menuView) {
        this.menuView = menuView;
    }

    public Integer getMenuPraise() {
        return menuPraise;
    }

    public void setMenuPraise(Integer menuPraise) {
        this.menuPraise = menuPraise;
    }

    public Integer getMenuComment() {
        return menuComment;
    }

    public void setMenuComment(Integer menuComment) {
        this.menuComment = menuComment;
    }

    public Integer getMenuCollect() {
        return menuCollect;
    }

    public void setMenuCollect(Integer menuCollect) {
        this.menuCollect = menuCollect;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getAuthorAvatar() {
        return authorAvatar;
    }

    public void setAuthorAvatar(String authorAvatar) {
        this.authorAvatar = authorAvatar;
    }
}
